<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
namespace app\agent\model;

class AdminModel extends \app\BaseModel
{
    protected $name = "longbing_admin";
    public function appAdmin()
    {
        return $this->hasOne("app\\agent\\model\\AppAdminModel", "admin_id", "admin_id");
    }
    public function role()
    {
        return $this->hasOne("app\\agent\\model\\AdminRoleModel", "role_id", "role_id");
    }
    public function createAdmin($data)
    {
        $data["create_time"] = time();
        $result = $this->save($data);
        return !empty($result);
    }
    public function updateAdmin($filter, $data)
    {
        $filter["status"] = 1;
        $data["update_time"] = time();
        $result = $this->where($filter)->update($data);
        return !empty($result);
    }
    public function getAdmin($filter)
    {
        $filter["deleted"] = 0;
        $filter["status"] = 1;
        $result = $this->where($filter)->find();
        if(!empty($result)) {
            $result = $result->toArray();
        }
        return $result;
    }
}

?>